# !/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np


def demo1():
    # 数据
    sizes = [30, 25, 15, 10, 20]
    labels = ['A', 'B', 'C', 'D', 'E']
    colors = ['red', 'blue', 'green', 'yellow', 'orange']
    explode = [0, 0.1, 0, 0, 0]  # 突出显示第二个扇形
    # 创建饼图，并添加阴影, autopct输出百分比
    plt.pie(sizes, labels=labels, colors=colors, explode=explode, autopct='%1.1f%%', shadow=True)

    # 创建饼图
    # plt.pie(sizes, labels=labels, colors=colors)

    # 添加解释列表并设置标题
    plt.legend(title='Legend Title')
    # 设置标题
    plt.title('Pie Chart')
    # 显示图表
    plt.show()


if __name__ == '__main__':
    demo1()
